package com.example.spring_demo.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class app {
    public static void main(String[] args) {
        ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
//获取bean
        BookDao bookDao1=(BookDao) ctx.getBean(  "bookDao");
        BookDao bookDao2=(BookDao) ctx.getBean(  "bookDao");
        System.out.println(bookDao1);
        System.out.println(bookDao2);
        BookService bookService=(BookService) ctx.getBean("bookService");
        System.out.println(bookService);
        bookDao1.save();
        bookDao1.BookDao();
        bookService.save();
    }
}
